<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
  <title>Cadastro de Usuários</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>

<?php
 	echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />";
if ($_GET['act']=="gravar"){
	
	include ("conexao.php");
	
	$cripsenha = md5($_POST['senha']);
	
	mysql_query("INSERT INTO USUARIOS (NOME, USUARIO, ID_CARGO, SENHA, EMAIL, ADUSER )
	VALUES ('{$_POST['nome']}', '{$_POST['usuario']}', '{$_POST['cargo']}', '$cripsenha', '{$_POST['email']}', 'n')");
	
	print "<center>Usuario criado com sucesso!</center>";

} else {
	
?>

	<form name="newuser" method="post" action="?act=gravar">
	<label>Nome Completo: <input type="text" name="nome"></label><BR><BR>
	<label>Usuario do Sistema: <input type="text" name="usuario"></label><BR><BR>
	<label>Cargo: <input type="text" name="cargo"></label><BR><BR>
	<label>Senha: <input type="password" name="senha"></label><BR><BR>
	<label>Email: <input type="text" name="email"></label><BR><BR>
	<input type="submit" value="Enviar!">	
	</form>	
<?php
}
?>

</body>
</html>
